<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>test</title>
</head>
<body>

</body>
<script type="text/javascript">

    function doTheThing() {
        console.log(definedLater);    //undefined  
        var definedLater;
        definedLater = 'I am defined!'
        console.log(definedLater)       // i am defined

        console.log(definedSimulateneously);    //undefined
        var definedSimulateneously = 'I am defined!'

        console.log(definedSimulateneously)     //i am defined
    
        doSomethingElse();
        function doSomethingElse(){
            console.log('I did it!');           //i did it 
        }


        functionVar();      //未定义就调用

        var functionVar = function(){
            console.log('I did it!');
        }
        
    }
    doTheThing();
</script>
</html>